//
//  NSObject+Add.m
//  
//
//  Created by  on 16/2/17.
//  Copyright © 2016年 . All rights reserved.
//

#import "NSObject+Add.h"

@implementation NSObject (Add)
-(BOOL)isEqualToStringAdd:(NSString *)str{
    if (self==nil || [self isEqual:[NSNull null]]) {
        return NO;
    }
    if (str==nil || [str isEqual:[NSNull null]]) {
        return NO;
    }
    //    NSRange range = [self rangeOfString:str];
    //    if (range.location == 0&&range.length == self.length) {
    //        return YES;
    //    }
    if ([self isKindOfClass:[NSString class]]) {
        if ([(NSString*)self isEqualToString:str]) {
            return YES;
        }
    }
    
    return NO;
}

-(NSString*)StringFormattingAdd{
    if (self==nil || [self isEqual:[NSNull null]]) {
        return @"";
    }
    return [NSString stringWithFormat:@"%@",self];
}

-(NSString*)convertString{
    if (self==nil || [self isEqual:[NSNull null]]) {
        return @"";
    }
    return [NSString stringWithFormat:@"%@",self];
}

-(BOOL)isNotEmpty{
    if (self == nil ||[self isEqual:[NSNull null]]) {
        return NO;
    }
    if ([self isKindOfClass:[NSString class]]) {
         NSString *s=[(NSString*)self stringByReplacingOccurrencesOfString:@" " withString:@""];
        if ([s isEqualToString:@""]) {
            return NO;
        }
    }
    return YES;
}

@end
